package com.sys.sprinngboot.goodtheater.service;

import com.sys.sprinngboot.goodtheater.bean.*;
import com.sys.sprinngboot.goodtheater.dao.OrderMapper;
import com.sys.sprinngboot.goodtheater.dao.SceneMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpSession;
import javax.swing.*;
import java.util.*;

@Slf4j
@Service
public class BookTicketService {
    @Autowired
    SceneMapper sceneMapper;
    @Autowired
    OrderMapper orderMapper;

    public List<OrderVo> ticket(User user){
        return orderMapper.getTicketByUserId(user.getId());
    }

    public Scene scenceById(BookForm bookForm){
        return sceneMapper.getById(bookForm.getSceneId());
    }

    public Scene scenceByIntId(Integer scenceid){
        return sceneMapper.getById(scenceid);
    }

    public int addOrder(Order order){
        log.info("new Order:{}",order);
        return orderMapper.addOrder(order);
    }

    public void updateScene(Scene scene){
        log.info("update scene:{}",scene);
        sceneMapper.updateScene(scene);
    }

    public List<Scene> book1(Integer movieId){
        return sceneMapper.getSceneCount(movieId);
    }

}
